class SessionStorage {
  set(key, value) {
    if (typeof value == "object") {
      value = JSON.stringify(value)
    }
    sessionStorage.setItem(key, value)
  }
  get(key) {
    let value = sessionStorage.getItem(key) || ""
    if (/^[\[\{]/.test(value)) {
      value = JSON.parse(value)
    }
    return value
  }
  del(key) {
    sessionStorage.removeItem(key)
  }
}

export default new SessionStorage